package com.example.shouybl.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.shouybl.R;
import com.example.shouybl.bean.ActivityComment;
import com.example.shouybl.utils.ImageLoaderUtil;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by Administrator on 2015/10/15.
 */
public class ActivityCommentAdapter extends AppBaseAdapter<ActivityComment> {
    public ActivityCommentAdapter(List<ActivityComment> list, Context context) {
        super(list, context);
    }

    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        ActivityComment comment=list.get(position);
        ViewHolder vh=ViewHolder.get(context,convertView,parent, R.layout.item_activity_comment_layout);
        ImageView ivHpic= (ImageView) vh.findViewById(R.id.iv_comment_hpic);
        TextView tvNickname= (TextView) vh.findViewById(R.id.tv_comment_nickname);
        TextView tvPubdate= (TextView) vh.findViewById(R.id.tv_comment_pubdate);
        TextView tvContent= (TextView) vh.findViewById(R.id.tv_comment_content);
        TextView tvFloor= (TextView) vh.findViewById(R.id.tv_comment_floor);

        tvNickname.setText(comment.getNickname());
        tvPubdate.setText(comment.getPubdate());
        tvFloor.setText(comment.getFloor()+"楼");
        tvContent.setText(comment.getContent());
        if (!comment.getHpic().equals("")){
            ImageLoader.getInstance().displayImage(comment.getHpic(),ivHpic, ImageLoaderUtil.getDefaultOptions());
        }
        return vh;
    }
}
